﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using miniTodo.ViewModel;

namespace miniTodo.View {
	/// <summary>
	/// EditTodoView.xaml の相互作用ロジック
	/// </summary>
	public partial class EditTodoView : Window {
		public EditTodoView(TodoViewModel data) {
			DataContext = data;
			InitializeComponent();
			BindingGroup.BeginEdit();

			_titleText.Select(_titleText.Text.Length, 0);
			_titleText.Focus();
		}

		private void CancelButton_Click(object sender, RoutedEventArgs e) {
			BindingGroup.CancelEdit();
			DialogResult = false;
			Close();
		}

		private void OkButton_Click(object sender, RoutedEventArgs e) {
			BindingGroup.CommitEdit();
			DialogResult = true;
			Close();
		}
	}
}
